1. Technical Field
This invention generally relates to computer systems, and more specifically relates to apparatus and methods for processing computer programs.
2. Background Art
Since the dawn of the computer age, computer systems have evolved into extremely sophisticated devices, and computer systems may be found in many different settings. Computer systems typically include a combination of hardware, such as semiconductors and circuit boards, and software, also known as computer programs. As advances in semiconductor processing and computer architecture push the performance of the computer hardware higher, more sophisticated computer software has evolved to take advantage of the higher performance of the hardware, resulting in computer systems today that are much more powerful than just a few years ago.
Computer systems typically include operating system software that controls the basic function of the computer, and one or more software application programs that run under the control of the operating system to perform desired tasks. For example, a typical IBM Personal Computer may run a Microsoft Windows operating system, and under the control of the operating system, a user may execute an application program, such as a word processor. Windows is a registered trademark of Microsoft Corporation. As the capabilities of computer systems have increased, the application software programs designed for high performance computer systems have become extremely powerful. Additionally, software development costs have continued to rise because more powerful and complex programs take more time, and hence more money, to produce.
One way in which the performance of application software programs has been improved while the associated development costs have been reduced is by using object oriented programming concepts. The goal of using object oriented programming is to create small, reusable sections of program code known as “objects” that can be quickly and easily combined and re-used to create new programs. This is similar to the idea of using the same set of building blocks again and again to create many different structures. The modular and re-usable aspects of objects will typically speed development of new programs, thereby reducing the costs associated with the development cycle. In addition, by creating and re-using a comprehensive set of well-tested objects, a more stable, uniform, and consistent approach to developing new computer programs can be achieved. The Java programming language developed by Sun Microsystems is one modern object oriented programming language that has become very popular in recent years.
Recent developments in Java include just-in-time (JIT) compilers. A JIT compiler is one specific example of a dynamic compiler that compiles portions of a computer program as the computer program is executing under control of a Java Virtual Machine (JVM) that includes dynamic compilation logic. Most JVMs can execute a program in different modes, namely interpreted mode and compiled mode, and typically begin program execution before the entire program is loaded. In interpreted mode, each Java virtual machine instruction is individually emulated using a pre-written subroutine of native machine instructions. Interpreting Java instructions does not require compilation, but is typically much slower than executing the same Java instruction that has been compiled. In compiled mode, the Java instructions are compiled into machine code. Compiling on-the-fly requires overhead. However, once the compilation has been done, the compiled code can then be executed very quickly. Thus, a JVM typically begins loading and running a program in interpreted mode, and will us a dynamic compiler to dynamically compile portions of the code that are frequently executed to improve performance.
Dynamic compilation logic typically resides within a dynamic compiler and determines what is compiled, when it is compiled, and how it is compiled. One significant problem with known dynamic compilers is that they have no information about what portions of a computer program to compile until the computer program has been executed enough to generate execution statistics that can govern which portions are dynamically compiled, when they are compiled, and how they are compiled and optimized. Some dynamic compilers simply compile a method the first time it is invoked. This approach, however, is inefficient because it results in spending considerable time compiling methods that may be rarely invoked. A second approach is to compile execution statistics that show which portions of a computer program are executed often, and dynamically compiling portions of the computer program as their execution frequencies exceed some predefined threshold value. For example, the threshold value can be set to the number ten, which means the dynamic compiler will dynamically compile a program portion once the program portion has been executed ten times. With this second approach, the computer program must be run for a long enough period of time to collect execution statistics as it runs before dynamic compilation can occur.
Thus, this type of dynamic compiler must wait for execution statistics for the current execution in order to know what portions to dynamically compile, when to dynamically compile them, and how to compile and optimize them. This is true even if the computer program has been executed thousands or millions of times in the past.
Without a way for a dynamic compiler to use knowledge of past executions of a computer program in performing dynamic compilations, the computer industry will continue to suffer inefficient methods for dynamic compilation that are limited to the current execution of a computer program.